<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<!--<link rel="stylesheet" href="../lib/layui/css/layui.css" />-->
		<!--<script type="text/javascript" src="../js/global.js"></script>
		<script type="text/javascript" src="../lib/layui/layui.js"></script>
		<link rel="stylesheet" href="lib/layui/css/layui.css" />
		
		-->

		<link rel="stylesheet" href="../lib/layui/css/layui.css" />
		<script type="text/javascript" src="../js/global.js"></script>
		<script type="text/javascript" src="../lib/layui/layui.js"></script>
		<link rel="stylesheet" href="./css/xadmin.css" media="all">
		<!--<script type="text/javascript" src="lib/layui/layui.js" ></script>
		<script type="text/javascript" src="./js/global.js" ></script>-->

	</head>

	<body>
		<div class="x-nav">
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
                <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
            </a>
        </div>
			<div class="layui-form-item" style="margin-left: 10px;margin-top: 10px;">
				<form class="layui-form" action="" method="post" onsubmit="return false;">
					<label class="layui-form-mid">姓名：</label>
					<div class="layui-input-inline" style="width: 100px;">
						<input class="layui-input" id="mname" placeholder="请输入姓名" />
					</div>
					<!--<label class="layui-form-mid">咨询师：</label>
					<div class="layui-input-inline" style="width: 100px;">
						<select class="layui-select" id="aid">
							<option title=""></option>
						</select>
					</div>-->
					<label class="layui-form-mid">性别:</label>
					<div class="layui-input-inline" style="width:100px;">
						<select class="layui-select" id="msex">
							<option value="">-请输入-</option>
							<option value="男">男</option>
							<option value="女">女</option>
						</select>
					</div>
					<!--<label class="layui-form-mid">学历:</label>
					<div class="layui-input-inline" style="width: 50px;">
						<input type="text" id="stuxueli" autocomplete="off" class="layui-input">
					</div>-->
					<!--<label class="layui-form-mid">年龄:</label>
					<div class="layui-input-inline" style="width: 50px;">
						<input type="text" id="beforeage" autocomplete="off" class="layui-input">
					</div>
					<div class="layui-form-mid">-</div>
					<div class="layui-input-inline" style="width: 50px;">
						<input type="text" id="afterage" autocomplete="off" class="layui-input">
					</div>-->
					<label class="layui-form-mid">是否缴费:</label>
					<div class="layui-input-inline" style="width:100px;">
						<select class="layui-select" id="sfmoney">
							<option value="">-请输入-</option>
							<option value="是">是</option>
							<option value="否">否</option>
						</select>
					</div>
					<label class="layui-form-mid">是否回访:</label>
					<div class="layui-input-inline" style="width:100px;">
						<select class="layui-select" id="sfhuif">
							<option value="">-请输入-</option>
							<option value="是">是</option>
							<option value="否">否</option>
						</select>
					</div>
					<label class="layui-form-mid">创建时间:</label>
					<div class="layui-input-inline" style="width: 150px;">
						<input type="text" id="year1" autocomplete="off" class="layui-input">
					</div>
					<div class="layui-form-mid">-</div>
					<div class="layui-input-inline" style="width: 150px;">
						<input type="text" id="year2" autocomplete="off" class="layui-input">
					</div>

					<div class="layui-input-inline" style="width: 100px;">
						<button id="sos" class="layui-btn layui-btn-xm"><i class="layui-icon">&#xe615;</i>搜索</button>
					</div>
				</form>
			</div>
			<!--修改-->
			<div id="updateDiv" class="layui-form-item" style="margin-top: 10px; margin-left:10px;display: none;">
				<form id="updateForm" lay-filter="updateForm" class="layui-form" method="post" onsubmit="return false;">
					
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">说明</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="hidden" name="id" id="stuid" disabled class="layui-input">
								<input type="text" name="content" id="content" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">是否有效</label>
							<div class="layui-input-inline" style="width:150px;">
						<select class="layui-select" name="isvalid" id="isvalid">
							<option value="">-请输入-</option>
							<option value="是">是</option>
							<option value="否">否</option>
						</select>
					      </div>
						</div>
					</div>
					
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">跟踪时间</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" id="firstvisittime" name="firstvisittime" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">是否在家</label>
							<div class="layui-input-inline" style="width:150px;">
						<select class="layui-select" id="ishome" name="ishome">
							<option value="">-请输入-</option>
							<option value="是">是</option>
							<option value="否">否</option>
						</select>
					       </div>
						</div>
					</div>
					
					
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">在家时间</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" name="hometime" id="hometime" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">是否支付</label>
							<div class="layui-input-inline" style="width:150px;">
						<select class="layui-select" name="ispay" id="ispay">
							<option value="">-请输入-</option>
							<option value="是">是</option>
							<option value="否">否</option>
						</select>
					      </div>
						</div>
					</div>
					
					
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">支付时间</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" name="paytime" id="paytime" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">是否退款</label>
							<div class="layui-input-inline" style="width:150px;">
						<select class="layui-select" name="isreturnmoney" id="isreturnmoney">
							<option value="">-请输入-</option>
							<option value="是">是</option>
							<option value="否">否</option>
						</select>
					      </div>
						</div>
					</div>
					
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">金额</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" name="money" id="money" lay-verify="required|number"  autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">是否报备</label>
							<div class="layui-input-inline" style="width:150px;">
						<select class="layui-select" name="isbaobei" id="isbaobei">
							<option value="">-请输入-</option>
							<option value="是">是</option>
							<option value="否">否</option>
						</select>
					     </div>
						</div>
					</div>
					
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">退款原因</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" name="returnmoneyreason" id="returnmoneyreason" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">创建时间</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" name="createtime" id="createtime" :disabled="disabled" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
							</div>
						</div>
					</div>
					<div class="layui-form-item" style="text-align: center;">
						<button id="updateBtn" class="layui-btn" lay-filter="test11" lay-submit>提交</button>
					</div>
				</form>
			</div>
			
			<!--详情-->
			<div id="xqDiv" class="layui-form-item" style="margin-top: 10px; margin-left:10px;display: none;">
				<form id="xqForm" lay-filter="updateForm" class="layui-form" method="post" onsubmit="return false;">
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">姓名</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="hidden" name="id" id="id1" disabled class="layui-input">
								<input type="text" name="name" id="name1" disabled lay-verify="required|number" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">性别：</label>
					          <div class="layui-input-inline" style="width: 150px;">
						           <input type="text" name="sex" id="sex1" disabled lay-verify="required|number" autocomplete="off" class="layui-input">
						      </div>
						</div>
						
					</div>

					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">学历</label>
							<div class="layui-input-inline" style="width: 150px;">
								<input type="text" name="stuxueli" disabled id="stuxueli1" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">年龄</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" name="age" id="age1" disabled lay-verify="required|number" autocomplete="off" class="layui-input">
							</div>
						</div>
						
					</div>
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">咨询师：</label>
					          <div class="layui-input-inline" style="width: 150px;">
						           <input type="tel" name="asker" disabled id="asker" autocomplete="off" class="layui-input">
						      </div>
						     </div>
						     
						     <div class="layui-inline">
							<label class="layui-form-label">手机号</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" id="phone1" name="phone" disabled lay-verify="required|number" autocomplete="off" class="layui-input">
							</div>
						</div>
					</div>
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">现居住地</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" id="address1" name="address" disabled lay-verify="required|number" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">来源方式</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" id="msgsource1" name="msgsource" disabled id="date" lay-verify="date" autocomplete="off" class="layui-input">
							</div>
						</div>
						
					</div>
					
					
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">QQ</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" name="qq" id="qq1" disabled lay-verify="required|number" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">微信</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" name="weixin" id="weixin1" disabled lay-verify="date"  autocomplete="off" class="layui-input">
							</div>
						</div>
					</div>
					
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">说明</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" name="content" id="content1" disabled lay-verify="required|number" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">是否有效</label>
							<div class="layui-input-inline" style="width:150px;">
								<input type="text" name="isvalid" disabled id="isvalid1" autocomplete="off" class="layui-input">
					      </div>
						</div>
					</div>
					
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">跟踪时间</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" id="firstvisittime1" disabled name="firstvisittime" lay-verify="required|number" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">是否在家</label>
							<div class="layui-input-inline" style="width:150px;">
								<input type="text" name="ishome" disabled id="ishome1" autocomplete="off" class="layui-input">
					       </div>
						</div>
					</div>
					
					
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">在家时间</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" name="hometime" disabled id="hometime1" lay-verify="required|number" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">是否支付</label>
							<div class="layui-input-inline" style="width:150px;">
								<input type="text" name="ispay" disabled id="ispay1" autocomplete="off" class="layui-input">
					      </div>
						</div>
					</div>
					
					
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">支付时间</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" name="paytime" disabled id="paytime1" lay-verify="required|number" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">是否退款</label>
							<div class="layui-input-inline" style="width:150px;">
								<input type="text" name="isreturnmoney" disabled id="isreturnmoney1" autocomplete="off" class="layui-input">
					      </div>
						</div>
					</div>
					
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">金额</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" name="money" disabled id="money1" lay-verify="date"  autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">是否报备</label>
							<div class="layui-input-inline" style="width:150px;">
								<input type="text" name="isbaobei" disabled id="isbaobei1" autocomplete="off" class="layui-input">
					     </div>
						</div>
					</div>
					
					
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">退款原因</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" name="returnmoneyreason" disabled id="returnmoneyreason1" lay-verify="required|number" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">创建时间</label>
							<div class="layui-input-inline"style="width: 150px;">
								<input type="text" name="createtime" disabled id="createtime1" :disabled="disabled" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
								<input type="hidden" name="createuser" disabled id="createuser1" :disabled="disabled" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
							</div>
						</div>
					</div>
				</form>
			</div>
			<!--创建跟踪-->
		<div id="createDiv" class="layui-form-item" style="margin-top: 10px; margin-left:10px;display: none;">
			<form id="createForm" lay-filter="createForm" class="layui-form" method="post" onsubmit="return false;">
				<div class="layui-form-item">
					<label class="layui-form-mid">预计跟踪日期：</label>
					<div class="layui-input-inline" style="width: 350px;">
						<input hidden="hidden" id="sstu"/>
						<input hidden="hidden" id="aasker" />
						<input class="layui-input" id="followid"  name="followtime" lay-verify="required|vname" />
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-mid">跟踪类型：</label>
					<div class="layui-input-inline" style="width: 350px;">
						<input class="layui-input"  name="followtype" lay-verify="required|vname" />
					</div>
				</div>
				<div class="layui-form-item" hidden="hidden">
					<label class="layui-form-mid">创建时间：</label>
					<div class="layui-input-inline" style="width: 350px;">
						<input class="layui-input" id="createid"  name="createtime" lay-verify="required|vname" />
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-mid">跟踪状态：</label>
					<div class="layui-input-inline" style="width: 350px;">
						<input class="layui-input"  name="followstate" lay-verify="required|vname" />
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-mid">跟踪内容：</label>
					<div class="layui-input-inline" style="width: 350px;">
						<textarea class="layui-textarea" name="content" lay-verify="required|vname"></textarea>
					</div>
				</div>
				<div class="layui-form-item" style="text-align: center;">
					<button id="createBtn" class="layui-btn" lay-filter="createtest" lay-submit>创建</button>
				</div>
			</form>
		</div>

			<script type="text/html" id="top">
				<!--<button class="layui-btn  layui-btn-lg layui-btn-warm" lay-event="upAll"> 批量修改</button>-->
				<button class="layui-btn layui-btn-normal" lay-event="dc"> <i class="layui-icon"></i>导出Excel</button>
				<button class="layui-btn" id="tjt">生成统计图</button>
			</script>
			<script type="text/html" id="ce">
				<button class="layui-btn  layui-btn-sm " lay-event="bj">编辑</button>
				<button class="layui-btn  layui-btn-sm layui-btn-danger" lay-event="deleAll"><i class="layui-icon">&#xe640;</i>删除</button>
				<button class="layui-btn  layui-btn-sm" lay-event="cj"> <i class="layui-icon">&#xe608;</i>创建跟踪</button>
				<button class="layui-btn  layui-btn-sm layui-btn-warm" lay-event="rz">跟踪日志</button>
			</script>
		<table id="tab" lay-filter="table"></table>
	</body>
	<script>
		layui.use(['table', 'form', 'layer', 'laydate','excel'], function() {
			var table = layui.table;
			var form = layui.form;
			var layer = layui.layer;
			var $ = layui.$;
			var laydate = layui.laydate;
			var arr = [];
			var excel=layui.excel;
			laydate.render({
					elem: '#followid',
					format: 'yyyy-MM-dd HH:mm:ss' //可任意组合
			});
			laydate.render({
				elem: '#year1',
				type: 'datetime' //可任意组合
			});
			laydate.render({
				elem: '#year2',
				type: 'datetime' //可任意组合
			});
			laydate.render({
				elem: '#paytime',
				type: 'datetime' //可任意组合
			});
			laydate.render({
				elem: '#hometime',
				type: 'datetime' //可任意组合
			});
			laydate.render({
				elem: '#firstvisittime',
				type: 'datetime' //可任意组合
			});
			table.render({
				elem: "#tab",
				method: "post",
				url: "http://localhost:8080/getStudentAll",
				where: {
					'token': globalData.getCurToken(),
					'uid':globalData.getCurUid()
				},
				page: true,
				toolbar: "#top",
				parseData: function(res) {
					return {
						"code": 0,
						"msg": "1",
						"count": res.totalElements,
						"data": res.content
					}
				},
				cols: [
					[{
							type: 'checkbox'
						},
						/*{
							title:"编号",
							width:'5%'
						},*/
						{
							field: "name",
							title: "姓名"
						}, {
							templet: '<div>{{d.asker.askername}}</div>',
							title: "咨询师姓名"
						}, {
							field: "content",
							title: "说明"
						}, {
							field: "ispay",
							title: "是否缴费"
						}, {
							field: "paytime",
							title: "缴费时间"
						}, {
							field: "ishome",
							title: "是否回访"
						},{
							field:"address",
							title:"地址"
						},{
							field:"createtime",
							title:"创建时间"
						},
						{
							title: "操作",
							templet: "#ce",
							width: '30%'
						},
					]
				],
				id: "aa"
			})
			//右侧工具栏
			table.on("tool(table)", function(obj) {
				var data = obj.data;
				var event = obj.event;
				var sid = data.id;
				if(event == "deleAll") {
					layer.confirm('确定要删除角色[' + data.name + ']的信息吗', function(index) {
						$.post("http://localhost:8080/deleteid", {
							"id": sid,
							'token': globalData.getCurToken()
						}, function(res) {
							if(res > 0) {
								layer.msg('删除成功',function(){
									location.reload();
								});
								
							}else if(res.code=-1){
							layer.msg(res.msg);
						} else {
								layer.msg('删除失败', {
									icon: 1,
									time: 2000
								});
							}
						})
					})

				} else if(event == "bj") {
					$("#stuid").val(sid);
					/*$("#name").val(data.name);
					$("#sex").val(data.sex);
					$("#stustate").val(data.stustate);
					$("#age").val(data.age);
					
					$("#phone").val(data.phone);
					$("#address").val(data.address);
					$("#msgsource").val(data.msgsource);
					$("#qq").val(data.qq);
					$("#weixin").val(data.weixin);
					$("#content").val(data.content);
					$("#isvalid").val(data.isvalid);
					$("#firstvisittime").val(data.firstvisittime);
					$("#ishome").val(data.ishome);
					$("#hometime").val(data.hometime);
					$("#ispay").val(data.ispay);
					$("#paytime").val(data.paytime);
					$("#isreturnmoney").val(data.isreturnmoney);
					$("#money").val(data.money);
					$("#isbaobei").val(data.isbaobei);
					$("#returnmoneyreason").val(data.returnmoneyreason);
					$("#createtime").val(data.createtime);*/
					form.val("updateForm", data);
					/*$("#createuser").val(data.createuser);*/
					$("#askername").val(data.asker.askerid);
				   data:{
				    disabled:true
				    
				   }
						layer.open({
						type: 1,
						content: $("#updateDiv"),
						title: "您正在编辑" + data.name + "的资料",
						area: ["600px", "650px"]
					})
				} else if(event=="cj"){
					$("#aasker").val(data.asker.askerid);
					$("#sstu").val(data.id);
					$("#createid").val(dateFtt("yyyy-MM-dd hh:mm:ss",new Date()));
						layer.open({
							type: 1,
							title: "创建",
							content: $("#createDiv"),
							area: ['500px', '600px']
						})
				}else if(event=="rz"){
						layer.open({
							type: 2,
							title: '日志信息',
							content:"/qxgl/netFile/netFollow.html?stuid="+data.id,
							maxmin: true, 
							area: ['750px', '600px']
						})
				}
			})
			
			//监听行单击事件（双击事件为：rowDouble）
			  table.on('rowDouble(table)', function(obj){
			    	var data=obj.data;
			  		$("#id1").val(data.id);
					$("#name1").val(data.name);
					$("#sex1").val(data.sex);
					$("#stuxueli1").val(data.stuxueli);
					$("#age1").val(data.age);
					$("#asker").val(data.asker.askername);
					$("#phone1").val(data.phone);
					$("#address1").val(data.address);
					$("#msgsource1").val(data.msgsource);
					$("#qq1").val(data.qq);
					$("#weixin1").val(data.weixin);
					$("#content1").val(data.content);
					$("#isvalid1").val(data.isvalid);
					$("#firstvisittime1").val(data.firstvisittime);
					$("#ishome1").val(data.ishome);
					$("#hometime1").val(data.hometime);
					$("#ispay1").val(data.ispay);
					$("#paytime1").val(data.paytime);
					$("#isreturnmoney1").val(data.isreturnmoney);
					$("#money1").val(data.money);
					$("#isbaobei1").val(data.isbaobei);
					$("#returnmoneyreason1").val(data.returnmoneyreason);
					$("#createtime1").val(data.createtime);
					//form.val("updateForm", data);
					$("#createuser1").val(data.createuser);
					//form.val("xqForm", data);
					layer.open({
						type: 1,
						area: ['600px', '600px'],
						content: $("#xqDiv"),
						title: "正在查看" + data.name + "-的信息"
					})
			    
			    //标注选中样式
			    obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
			  });
			
			
			form.on('submit(createtest)', function() {
					var data = $("#createForm").serialize()+ "&token=" + globalData.getCurToken()+"&aid="+$("#aasker").val()+"&sid="+$("#sstu").val();
					$.post('http://localhost:8080/Net/save', data, function(res) {
						if(res > 0) {
							layer.closeAll();
							active.reload();
							layer.msg("创建成功！");
							
						}else if(res.code=-1){
							layer.msg(res.msg);
						}
					}, "json")
				})
			
			form.on("submit(test11)",function(){
				var aa=$("#updateForm").serialize()+"&token="+globalData.getCurToken()+"&id="+$("#stuid").val();
				$.post("http://localhost:8080/saveupid",aa,function(a){
					if(a>0){
						layer.closeAll();
						layer.msg("修改成功",function(){
							location.reload();
						});
					}else if(a.code=-1){
							layer.msg(a.msg);
						}else if(a=0){
						layer.msg("修改失败",{
							icon:1,
							time:2000
						});
						active.reload();
					}
				})
			})
			//头部监听栏
			table.on("toolbar(table)", function(obj) {
				var event = obj.event;
				var data = obj.data;
				if(event == "upAll") {

					var data = table.checkStatus("aa").data;
					if(data.length < 1) {
						layer.msg("未选择需要修改的客户");
					} else {
						for(var i = 0; i < data.length; i++) {
							arr.push(data[i].id);
						}
						layer.open({
							type: 1,
							title: "批量修改",
							content: $("#upAllDiv"),
							area: ["300px", "300px"]
						})
					}
				} else if(event == "dc") {
				  var data = table.checkStatus("aa").data;
						if(data.length < 1) {
							layer.msg("未选择导出客户");
						/*}else if(res.code=-1){
							layer.msg(res.msg);*/
						} else {
							var dlform = document.createElement('form');
              dlform.style = "display:none;";
              dlform.method = 'post';
              dlform.action = globalData.server+"/ExcelOut";
              var hdnFilePath = document.createElement('input');
              hdnFilePath.type = 'hidden';
              hdnFilePath.name = 'token';
              hdnFilePath.value = globalData.getCurToken();
              var da = document.createElement('input');
              da.type = 'hidden';
              da.name = 'data';
              da.value =JSON.stringify(data);
              dlform.appendChild(hdnFilePath);
              dlform.appendChild(da);
              document.body.appendChild(dlform);
              dlform.submit();
              document.body.removeChild(dlform);
          }
						}


			})
			//批量修改操作
			form.on("submit(test2)", function() {
				var askerid = $("#bid").val();
				$.post("http://localhost:8080/StudentsaveAll", {
					"askerid": askerid,
					"ids": arr.join(),
					'token': globalData.getCurToken()
				}, function(aa) {
					if(aa > 0) {
						layer.msg("修改成功", {
							icon: 1,
							time: 2000
						});

						location.reload();
					}else if(aa.code=-1){
							layer.msg(aa.msg);
						} else {
						layer.msg("修改失败", {
							icon: 1,
							time: 2000
						});
						location.reload();
					}
				})
			})
			//咨询师角色
			$.post("http://localhost:8080/getAllAsker", {
				'token': globalData.getCurToken()
			}, function(res) {
				var html = "";
				for(var i = 0; i < res.length; i++) {
					html += "<option value=" + res[i].askerid + ">" + res[i].askername + "<options>";
				}
				$("#aid").append(html);
				$("#bid").append(html);
				$("#askerid").append(html);
				form.render("select");
			})
			active = {
				reload: function() {
					table.reload("aa", {
						where: {
							"mname": $("#mname").val(),
							"zxname": $("#aid").val(),
							"msex": $("#msex").val(),
							"beforeage": $("#beforeage").val(),
							"afterage": $("#afterage").val(),
							"sfmoney": $("#sfmoney").val(),
							"sfhuif": $("#sfhuif").val(),
							"beforecreatime": $("#year1").val(),
							"aftercreatime": $("#year2").val(),
							"stuxueli": $("#stuxueli").val()
						}
					})
				}
			}
			$("#sos").click(function() {
				active.reload();
			})
			
			//统计图
			$("#tjt").click(function(){
    			layer.confirm('请选择您要生成的统计图样式？',{ 
  					btn: ['饼图','柱状图'] //按钮
  					,btn1:function(){
  						layer.open({
							type:2,
							content:"/qxgl/tjt/bing.html?name="+globalData.getCurUName(),
							area:['450px','500px']
						})
				}, btn2:function(){
 					layer.open({
							type:2,
							content:"/qxgl/tjt/zhuzhuang.html?name="+globalData.getCurUName(),
							area:['450px','500px']
						})
				}
});
    	})
			
			//格式化时间
				function dateFtt(fmt, date) { //author: meizz 
					var o = {
						"M+": date.getMonth() + 1, //月份 
						"d+": date.getDate(), //日 
						"h+": date.getHours(), //小时 
						"m+": date.getMinutes(), //分 
						"s+": date.getSeconds(), //秒 
						"q+": Math.floor((date.getMonth() + 3) / 3), //季度 
						"S": date.getMilliseconds() //毫秒 
					};
					if(/(y+)/.test(fmt))
						fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
					for(var k in o)
						if(new RegExp("(" + k + ")").test(fmt))
							fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
					return fmt;
				}

		})
	</script>

	<!--批量修改-->
	<!--<div id="upAllDiv" style="display: none;">
		<form id="addform" lay-filter="addform" class="layui-form" action="" method="post" onsubmit="return false;">
			<div class="layui-form-item" align="center">
				<label class="layui-form-mid">改为咨询师：</label>
				<div class="layui-input-inline" style="width: 100px;">
					<select class="layui-select" id="bid">
						<option title=""></option>
					</select>
				</div>
			</div>
			<div class="layui-form-item" style="text-align: center;">
				<button id="updateAllBtn" class="layui-btn" lay-filter="test2" lay-submit>修改</button>
			</div>

		</form>
	</div>-->

</html>